package com.shouxin.attendance.database.model;

import com.shouxin.attendance.database.dao.BabyDao;
import com.shouxin.attendance.database.dao.ClazzDao;
import com.shouxin.attendance.database.dao.DaoSession;
import com.shouxin.attendance.database.dao.SwipeCardHistoryDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.ToOne;

@Entity(nameInDb = "t_swipe_card_history")
public class SwipeCardHistory {

	@Id
	private Long id;
	@NotNull
	private Long classId;
	@NotNull
	private Integer status;
	@NotNull
	private String sendTime;
	@NotNull
	private Long timeStamp;
	@NotNull
	private String sendDate;
	@NotNull
	private Long babyId;

	@ToOne(joinProperty = "babyId")
	private Baby baby;

	@ToOne(joinProperty = "classId")
	private Clazz clazz;
	/** Used to resolve relations */
	@Generated(hash = 2040040024)
	private transient DaoSession daoSession;
	/** Used for active entity operations. */
	@Generated(hash = 219783117)
	private transient SwipeCardHistoryDao myDao;

    @Generated(hash = 360268269)
    private transient Long baby__resolvedKey;

    @Generated(hash = 1210854875)
    private transient Long clazz__resolvedKey;

	@Generated(hash = 239523607)
	public SwipeCardHistory(Long id, @NotNull Long classId, @NotNull Integer status,
									@NotNull String sendTime, @NotNull Long timeStamp,
									@NotNull String sendDate, @NotNull Long babyId) {
					this.id = id;
					this.classId = classId;
					this.status = status;
					this.sendTime = sendTime;
					this.timeStamp = timeStamp;
					this.sendDate = sendDate;
					this.babyId = babyId;
	}

	@Generated(hash = 1004821077)
	public SwipeCardHistory() {
	}

	public Long getId() {
					return this.id;
	}

	public void setId(Long id) {
					this.id = id;
	}

	public Long getClassId() {
					return this.classId;
	}

	public void setClassId(Long classId) {
					this.classId = classId;
	}

	public Integer getStatus() {
					return this.status;
	}

	public void setStatus(Integer status) {
					this.status = status;
	}

	public String getSendTime() {
					return this.sendTime;
	}

	public void setSendTime(String sendTime) {
					this.sendTime = sendTime;
	}

	public Long getTimeStamp() {
					return this.timeStamp;
	}

	public void setTimeStamp(Long timeStamp) {
					this.timeStamp = timeStamp;
	}

	public String getSendDate() {
					return this.sendDate;
	}

	public void setSendDate(String sendDate) {
					this.sendDate = sendDate;
	}

	public Long getBabyId() {
					return this.babyId;
	}

	public void setBabyId(Long babyId) {
					this.babyId = babyId;
	}

	/** To-one relationship, resolved on first access. */
	@Generated(hash = 1198133836)
	public Baby getBaby() {
					Long __key = this.babyId;
					if (baby__resolvedKey == null || !baby__resolvedKey.equals(__key)) {
									final DaoSession daoSession = this.daoSession;
									if (daoSession == null) {
													throw new DaoException("Entity is detached from DAO context");
									}
									BabyDao targetDao = daoSession.getBabyDao();
									Baby babyNew = targetDao.load(__key);
									synchronized (this) {
													baby = babyNew;
													baby__resolvedKey = __key;
									}
					}
					return baby;
	}

	/** called by internal mechanisms, do not call yourself. */
	@Generated(hash = 1373534738)
	public void setBaby(@NotNull Baby baby) {
					if (baby == null) {
									throw new DaoException(
																	"To-one property 'babyId' has not-null constraint; cannot set to-one to null");
					}
					synchronized (this) {
									this.baby = baby;
									babyId = baby.getId();
									baby__resolvedKey = babyId;
					}
	}

	/** To-one relationship, resolved on first access. */
	@Generated(hash = 276623111)
	public Clazz getClazz() {
					Long __key = this.classId;
					if (clazz__resolvedKey == null || !clazz__resolvedKey.equals(__key)) {
									final DaoSession daoSession = this.daoSession;
									if (daoSession == null) {
													throw new DaoException("Entity is detached from DAO context");
									}
									ClazzDao targetDao = daoSession.getClazzDao();
									Clazz clazzNew = targetDao.load(__key);
									synchronized (this) {
													clazz = clazzNew;
													clazz__resolvedKey = __key;
									}
					}
					return clazz;
	}

	/** called by internal mechanisms, do not call yourself. */
	@Generated(hash = 1767521163)
	public void setClazz(@NotNull Clazz clazz) {
					if (clazz == null) {
									throw new DaoException(
																	"To-one property 'classId' has not-null constraint; cannot set to-one to null");
					}
					synchronized (this) {
									this.clazz = clazz;
									classId = clazz.getId();
									clazz__resolvedKey = classId;
					}
	}

	/**
	 * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
	 * Entity must attached to an entity context.
	 */
	@Generated(hash = 128553479)
	public void delete() {
					if (myDao == null) {
									throw new DaoException("Entity is detached from DAO context");
					}
					myDao.delete(this);
	}

	/**
	 * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
	 * Entity must attached to an entity context.
	 */
	@Generated(hash = 1942392019)
	public void refresh() {
					if (myDao == null) {
									throw new DaoException("Entity is detached from DAO context");
					}
					myDao.refresh(this);
	}

	/**
	 * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
	 * Entity must attached to an entity context.
	 */
	@Generated(hash = 713229351)
	public void update() {
					if (myDao == null) {
									throw new DaoException("Entity is detached from DAO context");
					}
					myDao.update(this);
	}

	/** called by internal mechanisms, do not call yourself. */
	@Generated(hash = 264246633)
	public void __setDaoSession(DaoSession daoSession) {
		this.daoSession = daoSession;
		myDao = daoSession != null ? daoSession.getSwipeCardHistoryDao() : null;
	}
}
